<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <!-- <link rel="stylesheet" href="./css/common.css">
    <link rel="stylesheet" href="./css/sidebar.css">
    <link rel="stylesheet" href="./css/form.css"> -->
</head>

<body>
    <div id="container">
        <header>
            <h1>蜗牛学院学生管理系统</h1>
        </header>
        <main>
            <aside>
                <dl>
                    <dt>学生管理</dt>
                    <dd><a href="./studentsAdd.html">新增学生</a></dd>
                    <dd><a href="./studentsList.html">学生列表</a></dd>
                </dl>
                <dl>
                    <dt>班级管理</dt>
                    <dd><a href="./classesAdd.html">新增班级</a></dd>
                    <dd><a href="./classesList.html">班级列表</a></dd>
                </dl>
                <dl>
                    <dt>班主任管理</dt>
                    <dd><a href="./directorsAdd.html">新增班主任</a></dd>
                    <dd><a href="./directorsAdd.html">班主任列表</a></dd>
                </dl>
                <dl>
                    <dt>教师管理</dt>
                    <dd><a href="./teachersAdd.html">新增教师</a></dd>
                    <dd><a href="./teachersList.html">教师列表</a></dd>
                </dl>
                <dl>
                    <dt>专业管理</dt>
                    <dd><a href="./subjectsAdd.html">新增专业</a></dd>
                    <dd><a href="./subjectsList.html">专业列表</a></dd>
                </dl>
                <dl>
                    <dt>排课管理</dt>
                    <dd><a href="#">新增排课</a></dd>
                    <dd><a href="#">排课列表</a></dd>
                </dl>
            </aside>
            <section>
                <div class="section-content form-content" id="studentsUpdate">
                    <h2>修改学生</h2>
                    <div class="content">
                        <div class="content-info">
                            <h3>修改数据</h3>
                            <div>
                                <div>
                                    <div class="content-row">
                                        <label>学生姓名：</label>
                                        <input class="form-input" type="text" id="studentsName">
                                    </div>
                                    <div class="content-row">
                                        <label>学生年龄：</label>
                                        <input class="form-input" type="text" id="studentsAge">
                                    </div>
                                    <div class="content-row">
                                        <label>
                                            学生性别：
                                        </label>
                                        <label style="margin-right: 30px;">
                                            <input type="radio" value="男" name="studentsGender">
                                            男
                                        </label>
                                        <label>
                                            <input type="radio" value="女" name="studentsGender">
                                            女
                                        </label>
                                    </div>
                                    <div class="content-row">
                                        <label>学生专业：</label>
                                        <select class="form-input" id="updateSubjectsId">

                                        </select>
                                    </div>
                                    <div class="content-row">
                                        <label>学生班级：</label>
                                        <select class="form-input" id="updateClassesId">

                                        </select>
                                    </div>
                                    <div class="content-row">
                                        <label>上传照片：</label>
                                        <input type="file">
                                    </div>
                                    <div class="content-row" style="margin-top: 50px;">
                                        <label></label>
                                        <button class="blue">确认修改</button>
                                    </div>
                                </div>
                                <!-- 照片预览区域 -->
                                <div class="right-info">
                                    <div class="image-frame">
                                        <img src="./images/default.jpeg" alt="">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        </main>
    </div>
    <!-- <script src="./js/jquery.min.js"></script>
    <script src="./js/sidebar.js"></script>
    <script src="./js/classes.js"></script>
    <script src="./js/subjects.js"></script>
    <script>
        getStudentsById();
        function getStudentsById() {
            $.ajax({
                url: '/students/getStudentsById',
                type: 'GET',
                data: { _id: location.search.split('=')[1] },
                success: async function (res) {
                    console.log(res);
                    if (res.code) {
                        $('#studentsName').val(res.result.name)
                        $('#studentsAge').val(res.result.age)
                        $(`[name=studentsGender][value=${res.result.gender}]`).prop('checked', true);
                        $('#updateSubjectsId').val(res.result.subjectsId);
                        // 获取并渲染当前专业下所有班级信息
                        const result = await getClassesBySubjectsId(res.result.subjectsId);
                        if (result) {
                            $('#updateClassesId').val(res.result.classesId);
                        }
                    }
                }
            })
        }
        // 修改学生所在专业
        $('#updateSubjectsId').change(function() {
            const subjectsId = $(this).val();
            getClassesBySubjectsId(subjectsId);
        })


    </script> -->
</body>

</html>